package com.example.managersystem_01.config;

import com.example.managersystem_01.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class LoginConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**")//所有资源都会拦截，包括静态资源
                .excludePathPatterns("/","/login","/enrolUser","/enrolController",
                        "/PwdModify","/pwdModify",
                        "/main", "/static/**");//访问静态目录下的文件，必须配置路径
    }
}
